package demo.wint.web.action;

import wint.mvc.flow.FlowData;
import wint.mvc.form.Form;
import wint.mvc.module.annotations.Action;
import demo.wint.biz.domain.UserDO;

public class User {

	@Action(defaultTarget="user/reg") 
	public void doReg(FlowData flowData) {
		Form form = flowData.getForm("user.reg");
		UserDO userDO = new UserDO();
		if (!form.apply(userDO)) {
			return;
		}
		System.out.println(userDO.getNick());
	}
	
	public void execute(FlowData flowData) {
		flowData.setTarget("/user/default");
		System.out.println("hello default");
	}
	
	@Action
	public void reg() {
		System.out.println("in reg()");
	}
	
	public void detail(FlowData flowData) {
		Form form = flowData.getForm("user.reg");
		UserDO userDO = new UserDO();
		userDO.setNick("昵称");
		userDO.setPassword("password123");
		form.hold(userDO);
	}
	
}
